﻿@model OrchardHUN.ExternalPages.Models.BitbucketSettingsPart

@{
    Script.Require("jQuery").AtFoot();
}

<fieldset>
    <legend>@T("Bitbucket Settings")</legend>
    <ol>
        @for (int i = 0; i < Model.Repositories.Count; i++)
        {
            <li class="orchardhun-external-pages-bitbucket-existing-repository">
                @Html.EditorFor(m => m.Repositories[i])
            </li>
        }
        <li>
            @Html.EditorFor(m => m.NewRepository)
        </li>
    </ol>
    <span class="hint">@T("WARNING: if some repositories need password then you should provide the passwords each time you save this page!")</span>
    <span class="hint">@T("Repositories with no username and password defined will only work if they're public.")</span>
    <span class="hint">@T("If the account or slug of a repository changes delete the repository entry and create a new one with the new configuration.")</span>
    <fieldset>
        <legend>@T("General Settings")</legend>
        <ol>
            <li>
                @Html.LabelFor(m => m.MinutesBetweenPulls, T("Minutes between pulls"))
                @Html.TextBoxFor(m => m.MinutesBetweenPulls, new { @class = "small" })
                @Html.ValidationMessageFor(m => m.MinutesBetweenPulls)
                <span class="hint">@T("New changesets from the repositories are pulled in with the frequency specified here (0 means every time the task runs; practically this is every minute). Note that after the changesets are pulled in they should be processed (one changeset every minute) so changes won't appear immediately after they're pulled in.")</span>
            </li>
        </ol>
    </fieldset>
</fieldset>

@using (Script.Foot())
{
    <script type="text/javascript">
        (function ($) {
            $(".orchardhun-external-pages-bitbucket-existing-repository .orchardhun-external-pages-bitbucket-repository-settings legend")
                .expandoControl(function (controller) { return controller.next("div"); }, { collapse: true, remember: false });
        })(jQuery);
    </script>
}